<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>首页</title>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="fonts/iconfont.css" />
	</head>
	<style type="text/css">
		html,
		body {
			padding: 0;
			margin: 0;
			font-family: "iconfont";
		}

		.mui-tab-item {
			padding-top: 10px;
		}

		.iconfont {
			display: block;
			font-size: 24px;
		}

		.mui-tab-label {
			font-size: 14px;
		}

		@media only screen and (max-width: 1080px) {}
	</style>

	<body>
		<nav class="mui-bar mui-bar-tab">
			<a class="mui-tab-item mui-active" data-id="home">
				<span class="iconfont icon-shouye"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item" data-id="contact">
				<span class="iconfont icon-zhangben1"></span>
				<span class="mui-tab-label">账单</span>
			</a>
			<a class="mui-tab-item" data-id="email">
				<span class="iconfont icon-huodong"></span>
				<span class="mui-tab-label">活动</span>
			</a>
			<a class="mui-tab-item" data-id="setting">
				<span class="iconfont icon-me"></span>
				<span class="mui-tab-label">我的</span>
			</a>
		</nav>

		<script src="js/mui.min.js"></script>
		<script type="text/javascript" src="js/config.js"></script>
		<script src="js/mobile-detect.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="controll/index1_2.js"></script>
		<script>
			mui.init({
				keyEventBind: {
					backbutton: function() {
						return false;
					},
					menubutton: function() {
						return false;
					}
				}
			});
			mui.plusReady(function() {
				updateVersion();
				//请求升级版本数据，并判断是否下载更新
				//更新版本
				function updateVersion() {
					//获取安装包版本号
					mui.getJSON("manifest.json", null, function(data) {
						var v = data.version.name;
						var srvVer = v;
						var system = "";
						//判断是安卓系统还是IOS系统
						ismobile(1) == 1 ? system = "Android" : system = "IOS";
						//对比安装包版本和最新版本，如果不同则更新，否则不更新
						mui.post(weburl + model_version, {
							"token": localStorage.getItem("token"),
							"system": system,
							"ver": srvVer
						}, function(data) {
							console.log(JSON.stringify(data));
							//安装包地址
							var data_url = data.data.url;
							//判断版本号是否一致
							if (compareVersion(srvVer, data.data.version)) {
								plus.nativeUI.confirm(data.data.note, function(data) {
									if (data.index == 0) {
										if (plus.os.name == "Android") {
											var wt = plus.nativeUI.showWaiting('下载更新中，请勿关闭');
											//下载安装包函数
											var dtask = plus.downloader.createDownload(data_url, {}, function(d, status) {
												if (status == 200) { // 下载成功   
													//关闭等待提示框
													//调用手机安装功能
													mui.confirm("下载完成，如未自动安装请手动进行安装！", "", "关闭", function() {});
													plus.nativeUI.closeWaiting();
													var path = d.filename;
													plus.runtime.install(path);
												} else { //下载失败   
													plus.nativeUI.closeWaiting();
													alert("下载失败，请前往应用市场下载");
												}
											});
											dtask.start();
										} else if (plus.os.name == "iOS") {
											plus.runtime.openURL(
												'https://itunes.apple.com/cn/app/%E5%A4%A9%E6%8B%A9%E5%8F%AF%E4%BB%98/id1278210839?mt=8')
										}
									}
								}, "版本更新", ["立即更新", "稍后更新"]);
							}
						}, "json")
					});
					var curVer = plus.runtime.version;
				}


			})

			
				
		</script>
	</body>

</html>
